Skip to content

removing ArgumentsDeclaration from the AST tree#1270

Merged
Janther merged 1 commit intomainfrom
skip-variants-1
Sep 30, 2025
Merged

removing ArgumentsDeclaration from the AST tree#1270
Janther merged 1 commit intomainfrom
skip-variants-1

Conversation

@Janther
Copy link
Copy Markdown
Member

@Janther Janther commented Sep 24, 2025

Introducing the idea of extractVariant

In previous PRs we introduced the idea of printVariant in order to avoid extra processing on Prettier's side. This is the next step of that idea where we extract the variant at the initiation moment and ignore the PolymorphicNode. This adds the following benefits:

  • less navigation through the tree when querying the state of a child or a parent whenever we happen to navigate through a PolymorphicNode
  • querying the state of a PolymorphicNode is now removed
  • less and cleaner code and smaller build size
  • there is a noticeable improvement in the speed

The downside is that the use of variants is used all around the codebase so the full change has been separated in individual commits (all of them will pass the CI) with a final cleanup commit.

All of these commits will follow the same idea but some impact the code much deeper than others so I'll be making PRs slowly so the changes can be individually reviewed.

This PR

We skip ArgumentsDeclaration, remove all variant queries, and remove all calls to printVariant for this particular node.

@Janther Janther requested a review from fvictorio September 24, 2025 15:39
@Janther Janther merged commit 56db4e4 into main Sep 30, 2025
7 checks passed
@Janther Janther deleted the skip-variants-1 branch September 30, 2025 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants